package cn.com.shadowless.xinning.presenter;

import androidx.annotation.NonNull;

import java.util.HashMap;
import java.util.Map;

import cn.com.shadowless.xinning.callback.RequestCallBack;
import cn.com.shadowless.xinning.model.RequestResult;
import cn.com.shadowless.xinning.model.order.AdniminiStrativeOrderInfo;
import cn.com.shadowless.xinning.model.order.ApprovalInfo;
import cn.com.shadowless.xinning.model.order.AssetPayInfo;
import cn.com.shadowless.xinning.model.order.AssetBrokenInfo;
import cn.com.shadowless.xinning.model.order.AssetMoveInfo;
import cn.com.shadowless.xinning.model.order.AssetApplyInfo;
import cn.com.shadowless.xinning.model.order.AssetRegisterCardInfo;
import cn.com.shadowless.xinning.model.order.CarNoInfo;
import cn.com.shadowless.xinning.model.order.CarOrderInfo;
import cn.com.shadowless.xinning.model.order.CheckHistoryList;
import cn.com.shadowless.xinning.model.order.CommunicateOrderInfo;
import cn.com.shadowless.xinning.model.order.CompanyBudgetOrderInfo;
import cn.com.shadowless.xinning.model.order.ContractReviewInfo;
import cn.com.shadowless.xinning.model.order.CostOrderInfo;
import cn.com.shadowless.xinning.model.order.DepartBudgetOrderInfo;
import cn.com.shadowless.xinning.model.order.DepartureOrderInfo;
import cn.com.shadowless.xinning.model.order.GeneralOrderInfo;
import cn.com.shadowless.xinning.model.order.MaintenanceOrderInfo;
import cn.com.shadowless.xinning.model.order.ProcureOrderInfo;
import cn.com.shadowless.xinning.model.order.PublicAssetsApplyInfo;
import cn.com.shadowless.xinning.model.order.SupplierInfo;
import cn.com.shadowless.xinning.model.order.TrainOrderInfo;
import cn.com.shadowless.xinning.model.order.TransportOrderInfo;
import cn.com.shadowless.xinning.model.order.TravelOrderInfo;
import cn.com.shadowless.xinning.net.HttpMethods;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

/**
 * The type General presenter.
 *
 * @author sHadowLess
 */
public class OrderPresenter extends HttpMethods {

    private volatile static OrderPresenter instance;

    private OrderPresenter() {
    }

    /**
     * Gets singleton.
     *
     * @return the singleton
     */
    public static OrderPresenter getSingleton() {
        if (instance == null) {
            synchronized (OrderPresenter.class) {
                if (instance == null) {
                    instance = new OrderPresenter();
                }
            }
        }
        return instance;
    }

    /**
     * Gets general order info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getGeneralOrderInfo(String orderId, String userName, RequestCallBack<GeneralOrderInfo> requestCallBack) {
        order
                .generalOrderInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<GeneralOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<GeneralOrderInfo> requestResult) {
                        requestCallBack.success(requestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets check history list.
     *
     * @param url             the url
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getCheckHistoryList(String url, String userName, RequestCallBack<CheckHistoryList> requestCallBack) {
        order
                .checkHistoryList(url, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<CheckHistoryList>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<CheckHistoryList> checkHistoryListRequestResult) {
                        requestCallBack.success(checkHistoryListRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets adnimini strative info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getAdniminiStrativeInfo(String orderId, String userName, RequestCallBack<AdniminiStrativeOrderInfo> requestCallBack) {
        order
                .adniminiStrativeInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<AdniminiStrativeOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<AdniminiStrativeOrderInfo> adniminiStrativeInfoRequestResult) {
                        requestCallBack.success(adniminiStrativeInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets cost order info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getCostOrderInfo(String orderId, String userName, RequestCallBack<CostOrderInfo> requestCallBack) {
        order
                .costOrderInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<CostOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<CostOrderInfo> costOrderInfoRequestResult) {
                        requestCallBack.success(costOrderInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets communicate info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getCommunicateInfo(String orderId, String userName, RequestCallBack<CommunicateOrderInfo> requestCallBack) {
        order
                .communicateInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<CommunicateOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<CommunicateOrderInfo> communicateInfoRequestResult) {
                        requestCallBack.success(communicateInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Get travel info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getTravelInfo(String orderId, String userName, RequestCallBack<TravelOrderInfo> requestCallBack) {
        order
                .travelInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<TravelOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<TravelOrderInfo> travelInfoRequestResult) {
                        requestCallBack.success(travelInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets train order info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getTrainOrderInfo(String orderId, String userName, RequestCallBack<TrainOrderInfo> requestCallBack) {
        order
                .trainOrderInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<TrainOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<TrainOrderInfo> trainOrderInfoRequestResult) {
                        requestCallBack.success(trainOrderInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets maintenance order info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getMaintenanceOrderInfo(String orderId, String userName, RequestCallBack<MaintenanceOrderInfo> requestCallBack) {
        order
                .maintenanceOrderInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<MaintenanceOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<MaintenanceOrderInfo> maintenanceOrderInfoRequestResult) {
                        requestCallBack.success(maintenanceOrderInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets depart budget order info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getDepartBudgetOrderInfo(String orderId, String userName, RequestCallBack<DepartBudgetOrderInfo> requestCallBack) {
        order
                .departBudgetOrderInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<DepartBudgetOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<DepartBudgetOrderInfo> departBudgetOrderInfoRequestResult) {
                        requestCallBack.success(departBudgetOrderInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets departure order info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getDepartureOrderInfo(String orderId, String userName, RequestCallBack<DepartureOrderInfo> requestCallBack) {
        order
                .departureOrderInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<DepartureOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<DepartureOrderInfo> departureOrderInfoRequestResult) {
                        requestCallBack.success(departureOrderInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets company budget order info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getCompanyBudgetOrderInfo(String orderId, String userName, RequestCallBack<CompanyBudgetOrderInfo> requestCallBack) {
        order
                .companyBudgetOrderInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<CompanyBudgetOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<CompanyBudgetOrderInfo> companyBudgetOrderInfoRequestResult) {
                        requestCallBack.success(companyBudgetOrderInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets transport order info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getTransportOrderInfo(String orderId, String userName, RequestCallBack<TransportOrderInfo> requestCallBack) {
        order
                .transportOrderInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<TransportOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<TransportOrderInfo> transportOrderInfoRequestResult) {
                        requestCallBack.success(transportOrderInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets asset register card info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getAssetRegisterCardInfo(String orderId, String userName, RequestCallBack<AssetRegisterCardInfo> requestCallBack) {
        order
                .assetRegisterCardInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<AssetRegisterCardInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<AssetRegisterCardInfo> assetRegisterCardInfoRequestResult) {
                        requestCallBack.success(assetRegisterCardInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets asset move info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getAssetMoveInfo(String orderId, String userName, RequestCallBack<AssetMoveInfo> requestCallBack) {
        order
                .assetMoveInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<AssetMoveInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<AssetMoveInfo> assetMoveInfoRequestResult) {
                        requestCallBack.success(assetMoveInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets asset broken info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getAssetBrokenInfo(String orderId, String userName, RequestCallBack<AssetBrokenInfo> requestCallBack) {
        order
                .assetBrokenInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<AssetBrokenInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<AssetBrokenInfo> assetBrokenInfoRequestResult) {
                        requestCallBack.success(assetBrokenInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets car order info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getCarOrderInfo(String orderId, String userName, RequestCallBack<CarOrderInfo> requestCallBack) {
        order
                .carOrderInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<CarOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<CarOrderInfo> carOrderInfoRequestResult) {
                        requestCallBack.success(carOrderInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets car no info.
     *
     * @param carNo           the car no
     * @param driverName      the driver name
     * @param pageIndex       the page index
     * @param usage           the usage
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getCarNoInfo(String carNo, String driverName, String pageIndex, String usage, String userName, RequestCallBack<CarNoInfo> requestCallBack) {
        order
                .carNoInfo(carNo, driverName, pageIndex, usage, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<CarNoInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<CarNoInfo> carNoInfoRequestResult) {
                        requestCallBack.success(carNoInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets procure order info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getProcureOrderInfo(String orderId, String userName, RequestCallBack<ProcureOrderInfo> requestCallBack) {
        order
                .procureOrderInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<ProcureOrderInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult<ProcureOrderInfo> procureOrderInfoRequestResult) {
                        requestCallBack.success(procureOrderInfoRequestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets check pass.
     *
     * @param billCode        the bill code
     * @param checkMessage    the check message
     * @param userName        the user name
     * @param orderId         the order id
     * @param requestCallBack the request call back
     */
    public void getCheckPass(String billCode, String checkMessage, String userName, String orderId, RequestCallBack<Object> requestCallBack) {
        Map<String, String> map = new HashMap<>();
        map.put("billCode", billCode);
        map.put("checkMessage", checkMessage);
        map.put("checkUser", userName);
        map.put("orderId", orderId);
        order
                .checkPass(map, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<Object>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult requestResult) {
                        requestCallBack.success(requestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets check reject pre.
     *
     * @param billCode        the bill code
     * @param checkMessage    the check message
     * @param userName        the user name
     * @param orderId         the order id
     * @param requestCallBack the request call back
     */
    public void getCheckRejectPre(String billCode, String checkMessage, String userName, String orderId, RequestCallBack<Object> requestCallBack) {
        Map<String, String> map = new HashMap<>();
        map.put("billCode", billCode);
        map.put("checkMessage", checkMessage);
        map.put("checkUser", userName);
        map.put("orderId", orderId);
        order
                .checkRejectPre(map, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<Object>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult requestResult) {
                        requestCallBack.success(requestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets check reject apply.
     *
     * @param billCode        the bill code
     * @param checkMessage    the check message
     * @param userName        the user name
     * @param orderId         the order id
     * @param requestCallBack the request call back
     */
    public void getCheckRejectApply(String billCode, String checkMessage, String userName, String orderId, RequestCallBack<Object> requestCallBack) {
        Map<String, String> map = new HashMap<>();
        map.put("billCode", billCode);
        map.put("checkMessage", checkMessage);
        map.put("checkUser", userName);
        map.put("orderId", orderId);
        order
                .checkRejectApply(map, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<Object>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(RequestResult requestResult) {
                        requestCallBack.success(requestResult);
                    }

                    @Override
                    public void onError(Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets supplier info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getSupplierInfo(String orderId, String userName, RequestCallBack<SupplierInfo> requestCallBack) {
        order
                .supplierInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<SupplierInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(@NonNull Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(@NonNull RequestResult<SupplierInfo> supplierInfoRequestResult) {
                        requestCallBack.success(supplierInfoRequestResult);
                    }

                    @Override
                    public void onError(@NonNull Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets public assets apply info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getPublicAssetsApplyInfo(String orderId, String userName, RequestCallBack<PublicAssetsApplyInfo> requestCallBack) {
        order
                .publicAssetsApplyInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<PublicAssetsApplyInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(@NonNull Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(@NonNull RequestResult<PublicAssetsApplyInfo> publicAssetsApplyInfoRequestResult) {
                        requestCallBack.success(publicAssetsApplyInfoRequestResult);
                    }

                    @Override
                    public void onError(@NonNull Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets contract review info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getContractReviewInfo(String orderId, String userName, RequestCallBack<ContractReviewInfo> requestCallBack) {
        order
                .contractReviewInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<ContractReviewInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(@NonNull Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(@NonNull RequestResult<ContractReviewInfo> contractReviewInfoRequestResult) {
                        requestCallBack.success(contractReviewInfoRequestResult);
                    }

                    @Override
                    public void onError(@NonNull Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets approval info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getApprovalInfo(String orderId, String userName, RequestCallBack<ApprovalInfo> requestCallBack) {
        order
                .approvalInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<ApprovalInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(@NonNull Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(@NonNull RequestResult<ApprovalInfo> contractReviewInfoRequestResult) {
                        requestCallBack.success(contractReviewInfoRequestResult);
                    }

                    @Override
                    public void onError(@NonNull Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets asset apply info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getAssetApplyInfo(String orderId, String userName, RequestCallBack<AssetApplyInfo> requestCallBack) {
        order
                .assetApplyInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<AssetApplyInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(@NonNull Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(@NonNull RequestResult<AssetApplyInfo> assetApplyInfoRequestResult) {
                        requestCallBack.success(assetApplyInfoRequestResult);
                    }

                    @Override
                    public void onError(@NonNull Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

    /**
     * Gets asset pay info.
     *
     * @param orderId         the order id
     * @param userName        the user name
     * @param requestCallBack the request call back
     */
    public void getAssetPayInfo(String orderId, String userName, RequestCallBack<AssetPayInfo> requestCallBack) {
        order
                .assetPayInfo(orderId, userName)
                .compose(obsIoMain())
                .subscribe(new Observer<RequestResult<AssetPayInfo>>() {
                    Disposable disposable;

                    @Override
                    public void onSubscribe(@NonNull Disposable d) {
                        disposable = d;
                    }

                    @Override
                    public void onNext(@NonNull RequestResult<AssetPayInfo> assetPayInfoRequestResult) {
                        requestCallBack.success(assetPayInfoRequestResult);
                    }

                    @Override
                    public void onError(@NonNull Throwable e) {
                        requestCallBack.fail(exceptionMessage(checkException(e)));
                    }

                    @Override
                    public void onComplete() {
                        disposable.dispose();
                    }
                });
    }

}
